Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-125260: gzip: let compress mtime default to 0 #125261

Merged
merged 4 commits into from
Oct 12, 2024
Merged

Conversation

bmwiedemann
Copy link
Contributor

@bmwiedemann bmwiedemann commented Oct 10, 2024

this follows GNU gzip, which defaults to
store 0 as mtime for compressing stdin, where no file mtime is involved

This makes gzip.compress(str) output deterministic by default and greatly helps reproducible builds.


📚 Documentation preview 📚: https://cpython-previews--125261.org.readthedocs.build/

@ZeroIntensity
Copy link
Member

This needs a NEWS entry, as this is a user-facing error. Also, could you add a test for this?

Doc/library/gzip.rst Outdated Show resolved Hide resolved
Lib/gzip.py Outdated Show resolved Hide resolved
@bedevere-app
Copy link

bedevere-app bot commented Oct 10, 2024

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@bmwiedemann
Copy link
Contributor Author

I have rebased it onto main now. I had probably based it off the old master branch.

I would appreciate some help with the NEWS and test. I only saw Misc/NEWS.d/3.13.0a1.rst but nothing for 3.14 yet.

@AA-Turner
Copy link
Member

AA-Turner commented Oct 10, 2024

You can use blurb it (see the devguide)

A

@AA-Turner
Copy link
Member

@ZeroIntensity I'm not sure about backport labels here as the function works as intended (so this is a feature) -- what was your rationale?

@ZeroIntensity
Copy link
Member

Hmm, is this a feature? The original issue was marked as a bug, so I thought it would be backportable.

@AA-Turner
Copy link
Member

It was opened with the bug template, hence the bug label, but it's a judgement call as to 'bug' or 'feature'. Personally I would be hesitant to backport, but others may have different opinions.

A

@ZeroIntensity
Copy link
Member

I think that's right, I'll update the labels. My bad!

@ZeroIntensity ZeroIntensity removed needs backport to 3.12 bug and security fixes needs backport to 3.13 bugs and security fixes labels Oct 10, 2024
@bmwiedemann
Copy link
Contributor Author

I have made the requested changes; please review again

@bedevere-app
Copy link

bedevere-app bot commented Oct 11, 2024

Thanks for making the requested changes!

@AA-Turner: please review the changes made to this pull request.

@bedevere-app bedevere-app bot requested a review from AA-Turner October 11, 2024 05:20
this follows GNU gzip, which defaults to
store 0 as mtime for compressing stdin, where no file mtime is involved

This makes gzip.compress(str) output deterministic by default
and greatly helps reproducible builds.
Copy link
Member

@ZeroIntensity ZeroIntensity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@mcepl mcepl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that looks like a great idea!

@mcepl
Copy link
Contributor

mcepl commented Oct 11, 2024

It was opened with the bug template, hence the bug label, but it's a judgement call as to 'bug' or 'feature'. Personally I would be hesitant to backport, but others may have different opinions.

The reason why Bernhard would like to consider it as a bug (and thus backport it) is that it breaks reproducible builds.

@nineteendo
Copy link
Contributor

As AA-Turner said, "the function works as intended (so this is a feature)" and thus not a bug. Only bugs can be backported.

@AA-Turner
Copy link
Member

@bmwiedemann please don't force-push, as it makes PRs harder to review. See the devguide for similar guidance. We squash-merge all commits.

Copy link
Member

@AA-Turner AA-Turner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've had to leave a couple of comments as diffs rather than suggestions due to limitations in the GH review interface -- sorry.

A

Lib/test/test_gzip.py Outdated Show resolved Hide resolved
Lib/gzip.py Show resolved Hide resolved
Doc/library/gzip.rst Show resolved Hide resolved
Doc/library/gzip.rst Show resolved Hide resolved
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Copy link

cpython-cla-bot bot commented Oct 12, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

Copy link
Member

@AA-Turner AA-Turner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

A

…eZ0Mb.rst

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
@AA-Turner AA-Turner merged commit dcd58c5 into python:main Oct 12, 2024
34 checks passed
@AA-Turner
Copy link
Member

Thanks @bmwiedemann!

A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants